package me.rocky.common.result;

/**
 * @author Rocky
 * @version 1.0
 * @description
 * @email inaho00@foxmail.com
 * @createDate 2021/3/12 9:31
 * @log
 */
public enum ResultCode implements IErrorCode {
	SUCCESS(200, "操作成功"),
	FAILED(500, "操作失败"),
	VALIDATE_FAILED(404, "页面不存在"),
	UNAUTHORIZED(401, "暂未登录或token已经过期"),
	USER_NOT_EXIST(406, "用户不存在"),
	AUTHORIZATION_HEADER_IS_EMPTY(600,"请求头中的token为空"),
	GET_TOKEN_KEY_ERROR(601,"远程获取TokenKey异常"),
	GEN_PUBLIC_KEY_ERROR(602,"生成公钥异常"),
	JWT_TOKEN_EXPIRE(603,"token校验异常"),
	TOMANY_REQUEST_ERROR(429,"后端服务触发流控"),
	BACKGROUD_DEGRADE_ERROR(604,"后端服务触发降级"),
	BAD_GATEWAY(502,"网关服务异常"),
	FORBIDDEN_OPERATION(503, "演示环境禁止修改、删除重要数据，请本地部署后测试"),
	USERNAME_OR_PASSWORD_ERROR(410, "用户名或密码错误"),
	CLIENT_AUTHENTICATION_FAILED(506, "客户端认证失败"),
	ACCESS_UNAUTHORIZED(507, "访问未授权"),
	TOKEN_INVALID_OR_EXPIRED(508, "token无效或已过期"),
	FORBIDDEN(403, "没有相关权限");
	private long code;
	private String message;

	private ResultCode(long code, String message) {
		this.code = code;
		this.message = message;
	}

	@Override
	public long getCode() {
		return code;
	}

	@Override
	public String getMessage() {
		return message;
	}
}